/*
	This SQL provides information to populate Views along with their columns.
	The INFORMATION_SCHEMA.COLUMNS view returns more than just tables so must restrict the
	results to just views.
*/

SELECT     TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, 
                      CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, 
                      DATETIME_PRECISION, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, CHARACTER_SET_NAME, COLLATION_CATALOG, 
                      COLLATION_SCHEMA, COLLATION_NAME, DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), 
                      COLUMN_NAME, 'IsIdentity') AS IS_IDENTITY, COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), 
                      COLUMN_NAME, 'IsComputed') AS IS_COMPUTED
FROM         INFORMATION_SCHEMA.COLUMNS WITH (NOLOCK)
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), 'IsTable') = 0  -- Only return Views
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION